package com.shurdroides.sintesi;

import java.util.List;

import javax.persistence.EntityManager;

public class ClaseHelper implements Controller<Long,Clase_evolutiva>{

	EntityManager em;
	
	public ClaseHelper(EntityManager em){
		setEntityManager(em);
	}
	@Override
	public void makePersistent(Clase_evolutiva object) throws Exception {
		try{
			em.getTransaction().begin();
			em.persist(object);
			em.getTransaction().commit();
		}catch(Exception e){
			em.getTransaction().rollback();
			e.printStackTrace();
		}finally{

		}
	}

	@Override
	public void update(Clase_evolutiva object) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void remove(Clase_evolutiva object) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Clase_evolutiva getByName(String name) {
		Clase_evolutiva u = (Clase_evolutiva) em.createQuery("select o from Clase_evolutiva o where o.nombre=\""+name+"\"").getSingleResult();
		return u;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void removeAll() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<Clase_evolutiva> getList() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setEntityManager(EntityManager em) {
		this.em=em;
		
	}

	@Override
	public Clase_evolutiva getById(Long clau) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean containsKey(Long clau) {
		// TODO Auto-generated method stub
		return false;
	}

}
